package com.example.feignconsumer.rest;

import com.example.feignconsumer.service.RefactorHelloService;
import com.example.helloserviceapi.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by yxw on 2017/10/18.
 * test
 */
@RestController
public class ConsumerController {

    @Autowired
    private RefactorHelloService refactorHelloService;

    /*@RequestMapping(value = "/feign-consumer", method = RequestMethod.GET)
    public String helloConsumer() {
        return refactorHelloService.hello();
    }*/


    @RequestMapping(value = "/feign-consumer2", method = RequestMethod.GET)
    public String helloConsumer2() {
        StringBuilder sb = new StringBuilder();
//        sb.append(refactorHelloService.hello()).append("\n");
        sb.append(refactorHelloService.hello("LOVE")).append("\n");
        sb.append(refactorHelloService.hello("love", 250)).append("\n");
        sb.append(refactorHelloService.hello(new User("love", 30))).append("\n");
        return sb.toString();
    }


}
